package org.totoro.patterns.behavior.iterator;

/**
 * Created by renkai on 2017/3/22.
 * <p>
 * <p>
 * 迭代器模式，其实就是返回了一个，对当前对象操作的工具类
 */
public class Client {
    public static void main(String[] args) {
        MyCollection myCollection = new MyCollection();
        Iterator iterator = myCollection.iterator();
        System.out.println(iterator.first());
        while (iterator.hasNext()) {
            Object next = iterator.next();
            System.out.println(next);
        }
    }
}
